package easy;

public class Solution_1252 {

    public int oddCells(int m, int n, int[][] indices) {
        int[] x = new int[m];
        int[] y = new int[n];
        for (int[] index : indices) {
            x[index[0]]++;
            y[index[1]]++;
        }
        int a = 0, b = 0, c = 0, d = 0;
        for (int i : x) {
            if (i % 2 == 0) {
                a++;
            } else {
                b++;
            }
        }
        for (int i : y) {
            if (i % 2 == 0) {
                c++;
            } else {
                d++;
            }
        }
        return a * d + b * c;
        /*int count = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if ((x[i] + y[j]) % 2 == 1) {
                    count++;
                }
            }
        }
        return count;*/
    }

    public static void main(String[] args) {
        Solution_1252 model = new Solution_1252();
        System.out.println(model.oddCells(2, 3, new int[][]{{0, 1}, {1, 1}}));
        System.out.println(model.oddCells(2, 2, new int[][]{{1, 1}, {0, 0}}));

    }
}
